<include file="/public/header" />
<style>
    @media screen and (min-width: 768px) {
    .layui-form-item .layui-input-inline {
        width: 300px;
    }

    table {
        border: 1px solid #e6e6e6;
    }

    table td {
        padding: 5px;
        padding-left: 8px;
        border: 1px solid #e6e6e6;
    }

    table td .layui-form-radio>i {
        font-size: 18px;
    }

    table td .layui-form-radio {
        margin: 0;
        padding: 0;
    }
    .layui-colla-title {
        height: 50px;
        line-height: 50px;
        padding-left: 10px;
    }
    .layui-colla-content {
        overflow: hidden;
        /* padding: 20px; */
    }
    .layui-colla-title {
        background-color: #fff;
    }
    .layui-colla-content, .layui-colla-item {
        border: none;
        /* margin-bottom: 5px; */
    }
    .layui-collapse .layui-colla-item .layui-colla-title i.layui-icon {
        margin-right: 5px;
    }
    .layui-colla-icon {
        display: none;
    }

    .layui-card-header .layui-icon {
        left: 5px;
        position:unset;
        margin-right: 5px;
    }
}

</style>
<div class="layui-fluid">
    <div class="layui-row">
        <div class="layui-card">
            <div class="layui-card-body">
                <form id="my-form" class="am-form tpl-form-line-form" method="post">
                    <!-- 你的HTML代码 -->
                    <div class="layui-tab">
                        <ul class="layui-tab-title">
                            <li class="layui-this">接口配置</li>
                            <li>其他配置</li>
                        </ul>
                        <div class="layui-tab-content">
                            <!-- tab开始 -->
                            <div class="layui-tab-item layui-show">
                                <div class="layui-collapse " lay-accordion="" style="border-style: none;">
                                    <div class="layui-colla-item">
                                        <h2 class="layui-colla-title"><img src="/staticFiles/images/interface/wechat.png" width="16" height="16" alt="微信支付">微信支付设置</h2>
                                        <div class="layui-colla-content">
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">app_id</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" width="500px" name="wechat[app_id]"  value="<?= $config['wechat']['app_id'] ?>" class="layui-input">
                                                </div>
                                                <div class="layui-form-mid layui-word-aux">* 公众号支付app_id</div>
                                            </div>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">appkey</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="wechat[appkey]"  value="<?= $config['wechat']['appkey'] ?>" class="layui-input">
                                                </div>
                                                <div class="layui-form-mid layui-word-aux">* 公众号支付的appkey</div>
                                            </div>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">miniapp_id</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="wechat[miniapp_id]"  value="<?= $config['wechat']['miniapp_id'] ?>" class="layui-input">
                                                </div>
                                                <div class="layui-form-mid layui-word-aux">*微信小程序支付miniapp_id</div>
                                            </div>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">mch_id</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="wechat[mch_id]" value="<?= $config['wechat']['mch_id'] ?>" class="layui-input">
                                                </div>
                                                <div class="layui-form-mid layui-word-aux"><font color="red">*</font>  微信支付绑定商户号的MCH_ID</div>
                                            </div>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">notify_url</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="wechat[notify_url]"  value="<?= $config['wechat']['notify_url'] ?>" class="layui-input">
                                                </div>
                                                <div class="layui-form-mid layui-word-aux"><font color="red">*</font>  微信支付成功回调地址</div>
                                            </div>
                                        </div>

                                        <div class="layui-colla-item">
                                            <h2 class="layui-colla-title"><img src="/staticFiles/images/interface/alipay.png" width="16" height="16" alt="支付宝支付">支付宝支付设置</h2>
                                            <div class="layui-colla-content">
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label">app_id</label>
                                                    <div class="layui-input-inline">
                                                        <input type="text" name="alipay[app_id]" value="<?= $config['alipay']['app_id'] ?>" class="layui-input"  >
                                                    </div>
                                                    <div class="layui-form-mid layui-word-aux">* 支付宝应用appid</div>
                                                </div>
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label">return_url</label>
                                                    <div class="layui-input-inline">
                                                        <input type="text" name="alipay[return_url]" value="<?= $config['alipay']['return_url'] ?>" class="layui-input">
                                                    </div>
                                                    <div class="layui-form-mid layui-word-aux">* 支付成功同步回调地址</div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!-- tab结束 -->

                            <!-- tab开始 -->
                            <div class="layui-tab-item">
                                <div class="layui-colla-item">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">app_id</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="alipay[app_id]" value="<?= $config['alipay']['app_id'] ?>" class="layui-input"  >
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">* 支付宝应用appid</div>
                                    </div>
                                </div>
                            </div>
                            <!-- tab结束 -->
                        </div>
                    </div>
                    <!-- // 接口配置信息开始 -->
                    <div class="layui-tab-content" >
                        <div class="am-form-group">
                            <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                <button type="submit" class="j-submit am-btn am-btn-secondary am-btn-sm">提交
                                </button>
                            </div>
                        </div>
                    </div>
                    <!-- // 接口信息配置结束 -->
                </form>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        /**
         * 表单验证提交
         * @type {*}
         */
        $('#my-form').superForm();

    });
</script>
<script src="https://www.layuicdn.com/auto/layuis.js" v="layui" e="layui"></script>
<script src="/staticFiles/js/common.js?{:config('app.version')}"></script>
<script>
    layui.use(['form','jquery','layedit'], function () {
 
        var form = layui.form;
        var jquery = layui.jquery;
        // 渲染富文本编辑器
        var layedit = layui.layedit;
        var layindex = layedit.build('site_notice', {height: 110,color: '#ffffff'});     
        // 异步验证表单
        form.verify({
            siteClose: function(value) { 
                return layedit.sync(layindex);
            }
        });

        // 增加变量
        jquery('.layui-variable-add').on('click',function(){
            var html = '<tr>';
                html += '<td><input type="text" class="layui-input layui-variable-key"  lay-verify="required" ><\/td>';
                html += '<td><input type="text" class="layui-input layui-variable-value"><\/td>';
                html += '<td><button type="button" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon layui-icon-delete"><\/i><\/button><\/td>';
                html += '<\/tr>';
            jquery('#layui-variable-content').append(html);
        })

        // 改变表单值
        jquery('body').on('change','.layui-variable-key',function() {
            var that = jquery(this),
                name = 'variable['+ that.val() +']';
            jquery(that).parents('tr').find('.layui-variable-value').attr('name',name);
        })

        // 删除自定义变量
        jquery('body').on('click','#layui-variable-content .layui-btn',function() {
            jquery(this).parents('tr').remove();
        })
    });
</script>
</body>
</html>
